package com.hc.fdkgoods.controller;


import com.hc.fdkgoods.common.Result;
import com.hc.fdkgoods.service.AssignSupplierService_9;
import com.hc.fdkgoods.service.ForwarderSupplierListService_8;
import com.hc.fdkgoods.service.QuerySpuIdListService;
import com.hc.fdkgoods.vo.vo_7.SpuIdListInputVO;
import com.hc.fdkgoods.vo.vo_7.SpuIdListOutputVO;
import com.hc.fdkgoods.vo.vo_8.ForwarderSupplierGroupListVO;
import com.hc.fdkgoods.vo.vo_9.ForwarderSkuListVO_9;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/forwarder/supplier")
public class SpuIdListController {
    @Resource
    QuerySpuIdListService querySpuIdListService;

    @PostMapping("/info")
    public Result<SpuIdListOutputVO> querySpuIdListInfo(@RequestBody SpuIdListInputVO spuIdListInputVO) {
        return Result.ok(querySpuIdListService.querySpuIdListInfo(spuIdListInputVO));
    }


    @Resource
    ForwarderSupplierListService_8 queryForwarderSupplierListService;

    @PostMapping("/list")
    public Result<ForwarderSupplierGroupListVO> querySupplierList() {
        return Result.ok(queryForwarderSupplierListService.queryFriendList());
    }

    @Resource
    AssignSupplierService_9 assignSupplierService_9;

    @PostMapping("/assign")
    public Result<ForwarderSkuListVO_9> insertOrUpdate(@RequestBody ForwarderSkuListVO_9 forwarderSkuListVO_9) {
        if (assignSupplierService_9.insertOrUpdateItem(forwarderSkuListVO_9) == 0) {
            return Result.ok();
        }
        return Result.error(403, "服务器开小差儿了！！！！！！！！");
    }


}
